zynqmp: Add new API for pl configuration readback
authorSiva Durga Prasad Paladugu <[email protected]>
Tue, 4 Sep 2018 12:11:34 +0000 (17:41 +0530)
committerSiva Durga Prasad Paladugu <[email protected]>
Tue, 4 Sep 2018 12:11:34 +0000 (17:41 +0530)
This patch adds new API's for performing pl configuration
readback.

Signed-off-by: Appana Durga Kedareswara rao <[email protected]>
Signed-off-by: Siva Durga Prasad Paladugu <[email protected]>
plat/xilinx/zynqmp/pm_service/pm_api_sys.c
plat/xilinx/zynqmp/pm_service/pm_api_sys.h
plat/xilinx/zynqmp/pm_service/pm_defs.h
plat/xilinx/zynqmp/pm_service/pm_svc_main.c

index fe1029f6606f9d6919549d6b43cd9e4b084761f0..18c6cd73432275931cd9e8864ab77c39d6091a96 100644 (file)
@@ -1183,3 +1183,33 @@ enum pm_ret_status pm_secure_image(uint32_t address_low,
                         key_hi, key_lo);
        return pm_ipi_send_sync(primary_proc, payload, value, 2);
 }
+
+/**
+ * pm_fpga_read - Perform the fpga configuration readback
+ *
+ * @reg_numframes: Configuration register offset (or) Number of frames to read
+ * @address_low: lower 32-bit Linear memory space address
+ * @address_high: higher 32-bit Linear memory space address
+ * @readback_type: Type of fpga readback operation
+ *                0 -- Configuration Register readback
+ *                1 -- Configuration Data readback
+ * @value:     Value to read
+ *
+ * This function provides access to the xilfpga library to read
+ * the PL configuration.
+ *
+ * Return: Returns status, either success or error+reason.
+ */
+enum pm_ret_status pm_fpga_read(uint32_t reg_numframes,
+                               uint32_t address_low,
+                               uint32_t address_high,
+                               uint32_t readback_type,
+                               uint32_t *value)
+{
+       uint32_t payload[PAYLOAD_ARG_CNT];
+
+       /* Send request to the PMU */
+       PM_PACK_PAYLOAD5(payload, PM_FPGA_READ, reg_numframes, address_low,
+                        address_high, readback_type);
+       return pm_ipi_send_sync(primary_proc, payload, value, 1);
+}
index c304895ac9ed40799adb301ae528f356653469f6..3726e8569c13df2f9f03273fe7c5aabec8a01cc2 100644 (file)
@@ -166,4 +166,11 @@ enum pm_ret_status pm_secure_image(uint32_t address_low,
                                   uint32_t key_lo,
                                   uint32_t key_hi,
                                   uint32_t *value);
+
+enum pm_ret_status pm_fpga_read(uint32_t reg_numframes,
+                               uint32_t address_low,
+                               uint32_t address_high,
+                               uint32_t readback_type,
+                               uint32_t *value);
+
 #endif /* _PM_API_SYS_H_ */
index 9a8026f464efd3bcedbe7621fd771580dac64cc5..0775bf9e68d8e24570c2393bc94a0e61a1e411cf 100644 (file)
@@ -89,6 +89,8 @@ enum pm_api_id {
        PM_CLOCK_SETPARENT,
        PM_CLOCK_GETPARENT,
        PM_SECURE_IMAGE,
+       /* FPGA PL Readback */
+       PM_FPGA_READ,
        PM_API_MAX
 };
 
index dd9bbc8c7a1a800b4979b2543b818ed499585ad4..92b7b3e83989a0c708fd8659cc8624d716ae216d 100644 (file)
@@ -546,6 +546,15 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
                         result[1]);
        }
 
+       case PM_FPGA_READ:
+       {
+               uint32_t value;
+
+               ret = pm_fpga_read(pm_arg[0], pm_arg[1], pm_arg[2], pm_arg[3],
+                                  &value);
+               SMC_RET1(handle, (uint64_t)ret | ((uint64_t)value) << 32);
+       }
+
        default:
                WARN("Unimplemented PM Service Call: 0x%x\n", smc_fid);
                SMC_RET1(handle, SMC_UNK);